package C6_1_CreationMethod.before;

import java.util.Date;

/**
 * Desc:&emsp;&ensp;贷款风险评估
 *
 * @author 李渊&emsp;liyuan7@yusys.com.cn
 * @version 1.0
 * @since V4.3&emsp;2022/8/25
 */
public class Loan {

    public Loan(double commitment, int riskRating, Date maturity) {
        this(commitment,0.00,riskRating, maturity, null);
    }
    public Loan(double commitment, int riskRating, Date maturity, Date expiry) {
        this(commitment,0.00,riskRating, maturity, expiry);
    }
    public Loan(double commitment,double outstanding, int riskRating, Date maturity, Date expiry) {
        this(null, commitment, outstanding,riskRating, maturity, expiry);
    }
    public Loan(CapitalStrategy capitalStrategy, double commitment, int riskRating, Date maturity, Date expiry) {
        this(capitalStrategy, commitment, 0.00, riskRating, maturity, expiry);
    }

    /**
     * @param capitalStrategy 资经战略
     * @param commitment
     * @param outstanding
     * @param riskRating 风险利率
     * @param maturity 到期
     * @param expiry 有效期
     */
    public Loan(CapitalStrategy capitalStrategy, double commitment, double outstanding, int riskRating, Date maturity, Date expiry) {
        this.capitalStrategy = capitalStrategy;
        this.commitment = commitment;
        this.outstanding = outstanding;
        this.riskRating = riskRating;
        this.maturity = maturity;
        this.expiry = expiry;

        if (capitalStrategy == null) {
            if (expiry == null) {
                // 定期
                this.capitalStrategy = new CapitalStrategyTermLoan();
            } else if (maturity == null) {
                // 循环贷款，信用卡
                this.capitalStrategy = new CapitalStrategyRevolver();
            } else {
                // 循环信用定期贷款，满气候转为定期贷款
                this.capitalStrategy = new CapitalStrategyRCTL();
            }
        }
    }



    private CapitalStrategy capitalStrategy;
    private double commitment;
    private double outstanding;
    private int riskRating;
    private Date maturity;
    private Date expiry;


}
